<?php

/**
 *   连接数据库类
 *   
 */

class DB{
   private $_host;
   private $_user;
   private $_password;
   private $_dbname;
   private $_charset;
   private $_link;
   
	/**
	 * 析构函数  初始化变量
	 */
	function __construct($configs=array()){
		//传入数组,初始化变量后再把值赋给本身  在整个脚本可以调用他的属性
	    $this->configs=array_merge($this->configs,$configs);

	    //连接数据库
		public function db_connect()
		{
			try{
			   $this->_link = new PDO("mysql:host=".$this->_host.";dbname=".$this->_dbname.";charset=utf8",'root','');
			}catch(PDOException $e){
				echo "Error:".$e;
            }
		}
	}

}	
   
    


















}



















